In Ruby on Rails Routing I Would Like to Use Dash `-` Instead of Underscore `_`
Posted
by
pablitostar
on Stack Overflow
See other posts from Stack Overflow
or by pablitostar
Published on 2011-03-17T03:09:20Z
Indexed on
2011/03/17
8:09 UTC
Read the original article
Hit count: 219
I would like all the URLs for my web applications to use dash -
instead of underscore _
for word separators. I'm surprised about a couple of things really:
- Google et al. continue to distinguish them.
- That RoR doesn't have a simple global configuration parameter to map
-
to_
in the routing. Or does it?
I found a few questions here and elsewhere, but the best solution I've seen is to use :as
or a named route. That's quite annoying. So I'm thinking of modifying the Rails routing to check for that global config and change -
to _
before dispatching to a controller action. But before I do that, I'm hoping someone can save me the trouble!
Thanks in advance for any help, or even confirmation that my approach makes sense. I'd submit it back. BTW, I'm currently on 2.3.8, but hope to migrate to 3 soon.
© Stack Overflow or respective owner